package com.handpay.nocardpay.baselibrary.setting.view.fragment;

import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.TextView;

import com.handpay.nocardpay.baselibrary.R;
import com.handpay.nocardpay.baselibrary.commbase.view.fragment.BaseFragment;

/**
 * Created by sxshi on 2017/8/20.
 */

public class VersionIntroductionFragment extends BaseFragment {
    private TextView version_number, version_description;

    public static VersionIntroductionFragment newInstance(String version, String versionDesc) {
        Bundle args = new Bundle();
        args.putString("version", version);
        args.putString("desc", versionDesc);
        VersionIntroductionFragment fragment = new VersionIntroductionFragment();
        fragment.setArguments(args);
        return fragment;
    }

    @Override
    public int getLayoutId() {
        return R.layout.fragment_instroduction;
    }

    @Override
    public String getFragmentTitle() {
        return _mActivity.getString(R.string.introduction);
    }

    @Override
    public void initView(View view) {
        Toolbar mToolbar = (Toolbar) view.findViewById(R.id.toolbar);
        initToolbar(mToolbar, true);
        version_number = (TextView) view.findViewById(R.id.version_number);
        version_description = (TextView) view.findViewById(R.id.version_description);
    }

    @Override
    public void initListener() {

    }

    @Override
    public void initData(Bundle savedInstanceState) {
        String version = getArguments().getString("version");
        String desc = getArguments().getString("desc");
        version_number.setText(String.format("%s%s", _mActivity.getString(R.string.current_version_number), version));
        String description = desc.replace("&", "\n");
        version_description.setText(String.format("%s%s", getString(R.string.update_context), description));
    }
}
